import { requestClient } from '#/api/request';

export interface List {
  key: string;
  value: string;
}
/**
 *
 */
export async function setConfig(data: List) {
  return requestClient.put('/config', data);
}

export async function getConfig() {
  return requestClient.get('/config');
}

export async function putSymbol(data: any) {
  return requestClient.put('/symbol', data);
}
export async function reqSymbolList(data: any) {
  return requestClient.get('/symbol', data);
}

export async function requestTradingObject(data: any) {
  return requestClient.get('/symbol', data);
}

export type IOptions = {
  [key: string]: any;
  id: number;
  name: string;
  platform?: string[];
  show?: number;
};

/** 获取 自选symbol选项*/
export async function reqSymbol() {
  return requestClient.get('/symbol');
}
interface ISetOption {
  name: string;
}
interface ISet {
  lists: ISetOption[];
}
/** 设置支持的symbol选项 */
export async function reqSetSymbol(data: ISet) {
  return requestClient.post('/setShowSymbol', data);
}

/** 获取 已支持的symbol选项*/
export async function reqSupportedSymbolByName(name: string) {
  return requestClient.get('/getSymbol', { params: { name } });
}

/** 设置持仓展示的币种 */
export async function reqSetPositionSymbol(data: any) {
  return requestClient.post('/setOpenSymbol', data);
}
